package com.summer.campussct.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.summer.campussct.pojo.Dictionary;
import com.summer.campussct.pojo.dto.RestResult;
import com.summer.campussct.service.IDictionaryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("sys")
public class DictionaryController {

    @Resource
    private IDictionaryService dictionaryService;

    @ApiOperation("查询数据字典")
    @GetMapping("dictionary")
    public RestResult getDictionary(){
        return RestResult.success(dictionaryService.list(new LambdaQueryWrapper<Dictionary>()
                .select(Dictionary::getCode, Dictionary::getItemValues)));
    }

}
